// 该组件为通用表格详情组件，被多个页面复用，已归类到 common 目录
<template>
  <el-descriptions :title="title" :column="column" border>
    <el-descriptions-item v-for="item in columns" :key="item.prop" :span="item.span">
      <template #label>{{ item.label }}</template>
      <slot :name="item.prop" :rows="row">
        {{ item.value || row[item.prop] }}
      </slot>
    </el-descriptions-item>
  </el-descriptions>
</template>

<script lang="ts" setup>
  const props = defineProps({
    title: {
      type: String,
      required: false,
      default: '',
    },
    row: {
      type: Object,
      required: false,
      default: () => ({}),
    },
    column: {
      type: Number,
      required: false,
      default: 2,
    },
    columns: {
      type: Object,
      required: true,
    },
  })
  const { row, title, column, columns } = props
</script>
